#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QComboBox>
#include <QPushButton>
#include <QLineEdit>
#include <QProgressBar>
#include <QGridLayout>
#include <QFileDialog>
#include "otathread.h"
#include "ymodem.h"
#include <QtSerialPort/QSerialPort>
#include <QtSerialPort/QSerialPortInfo>
#include <QMessageBox>
#include <QDebug>

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = 0);
    ~Widget();

private:
    OTAThread *otaThread; //ota线程
    bool otaState = 0; // 0未开始ota，1开始ota
    QString filePath; //文件路径;
    QString SerialPort; //端口号

    QComboBox *PortComboBox;
    QPushButton *UpDataButton;
    QPushButton *AddBinButton;
    QPushButton * BurnSelection;
    QLineEdit *FilePathLineEdit;
    QGridLayout *layout;
    QProgressBar *ProgressBar;

private slots:
    bool openFile();
    void otaSwitch();
    bool upData();

signals:
    void messageToSend(const QString& filePath , const QString& SerialPort); //线程通讯信号

};

#endif // WIDGET_H
